package org.f0rb.demo.model.userrole;

import org.f0rb.core.web.WebModel;

import java.io.Serializable;

/**
 * Class org.f0rb.demo.model.role description goes here.
 *
 * @author Administrator
 * @version 1.0.0 11-9-29
 */
public class UserRole extends WebModel<UserRole> implements Serializable {
    public Integer userid;
    public Integer roleid;

    @Override
    public String model() {
        return "UserRole";
    }

    @Override
    public void fillByModel(UserRole userRole) {
        userid = userRole.userid;
        roleid = userRole.roleid;
    }

    @Override
    public UserRole fillInModel(UserRole userRole) {
        userRole.roleid = roleid;
        userRole.userid = userid;
        return userRole;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof UserRole)) return false;

        UserRole userRole = (UserRole) o;
        return roleid.equals(userRole.roleid) && userid.equals(userRole.userid);
    }

    @Override
    public int hashCode() {
        int result = userid != null ? userid.hashCode() : 0;
        result = 31 * result + (roleid != null ? roleid.hashCode() : 0);
        return result;
    }
}
